<!DOCTYPE html>
<html xmlns:layout="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
	layout:decorate="~{common/layoutAdmin}">

<head>
	<meta charset="UTF-8">
	<title>试题练习管理系统</title>
</head>

<body>
	<div layout:fragment="fragment_body">
		<el-row>
			<el-tabs v-model="query.type" @tab-click="tabClick">
			    <el-tab-pane label="章节练习记录" name="0"></el-tab-pane>
			    <!--<el-tab-pane label="测验测试记录" name="1"></el-tab-pane>-->
			  </el-tabs>
		</el-row>
		<el-row>
			<el-table :data="students" border style="width: 100%">
				<el-table-column prop="account.accountNick" label="测验人">
				</el-table-column>
				<el-table-column prop="chapter.chapterTitle" label="章节">
				</el-table-column>
				<el-table-column prop="recordStart" label="开始时间">
				</el-table-column>
				<el-table-column prop="recordEnd" label="提交时间">
				</el-table-column>
				<!--<el-table-column prop="recordTotal" label="总分">
				</el-table-column>
				<el-table-column prop="recordScore" label="得分">
				</el-table-column>-->
				<el-table-column prop="recordRight" label="答对数量">
				</el-table-column>
				<el-table-column prop="recordWrong" label="答错数量">
				</el-table-column>
				<el-table-column prop="recordStatus" label="状态">
					<template slot-scope="scope">
					<el-tag type="success" v-if="scope.row.recordStatus*1 === 0">进行中</el-tag>
					<el-tag type="warning"  v-if="scope.row.recordStatus*1 === 1">暂存</el-tag>
					<el-tag type="primary"  v-if="scope.row.recordStatus*1 === 2">提交</el-tag>
					</template>
				</el-table-column>
				<!--<el-table-column prop="studentGradTime" label="操作">
					<template slot-scope="scope">
				        <el-button @click="showDetail(scope.row)" type="text" size="small">答题过程</el-button>
				      </template>
				</el-table-column>-->
			</el-table>
		</el-row>
	</div>
</body>
<script type="text/javascript" layout:fragment="fragment_script">
	let vueData = {
		students: [],
		query:{
			type: 0
		}
	}
	let vueMethods = {
		tabClick(){
			this.getRecords()
		},
		getRecords() {
			let that = this
			postRequst('/admin/getRecords', that.query, true).then(function (resp) {
				that.students = resp.rows
			})
		},
		showDetail(row) {
			let that = this
		}
	}
	function vueCreated() {
		let that = this
		that.getRecords()
	}
</script>

</html>